package com.itheima.request.foward;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/demo9")
public class ServletDemo9 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        /*System.out.println("demo9...");
        req.setAttribute("username",100);
        //转发跳转到demo10资源
        req.getRequestDispatcher("/demo10").forward(req,resp);*/
        System.out.println("demo9...");
        req.setAttribute("username",100);
        //转发跳转到demo10资源
        req.getRequestDispatcher("/demo10").forward(req,resp);

    }
}
